package com.heima.wemedia.feign;

import com.heima.apis.wemedia.IWeMediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MediaClient implements IWeMediaClient {
    @Autowired
    private WmSensitiveService wmSensitiveService;

    /**
     * 查询敏感词
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/sensitive/list")
    public ResponseResult list(@RequestBody SensitiveDto dto){
        return wmSensitiveService.list(dto);
    }

    @PostMapping("/api/v1/sensitive/save")
    public ResponseResult save(@RequestBody WmSensitive wmSensitive){
        return wmSensitiveService.saveSensitive(wmSensitive);
    }

    @DeleteMapping("/api/v1/sensitive/del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return wmSensitiveService.deleteSeneitive(id);
    }

    @PostMapping("/api/v1/sensitive/update")
    public ResponseResult update(@RequestBody WmSensitive wmSensitive){
        return wmSensitiveService.updateSemsitive(wmSensitive);
    }

}
